<#include "user/_user_center_layout.html" />
<@layout>
<@userLayout>
<div class="form-group">
    <label class="col-sm-3 control-label">邮箱</label>
    <div class="col-sm-9">
        <input type="text" class="form-control" id="mail" name="mail" value="">
        <span class="help-block">输入邮箱重置您的密码</span>
    </div>
</div>

<div class="form-group">
    <div class="col-sm-offset-3 col-sm-9">
        <button type="button" id="profile_sub" class="btn btn-primary">提交资料</button>
        <div id="editRealMsgImg">提交中....</div>
    </div>
</div>
<script>
    $("#editRealMsgImg").hide();
    $("#profile_sub").click(function () {
        var av = $("#mail").val();
        if (av == "" || av == null) {
            alert("请输入邮箱。");
            return;
        }
        jQuery.ajax({
            url: '${CPATH}/member/resetPassword.html',
            data: {mail: av},
            type: "POST",
            beforeSend: function () {
                $('#profile_sub').hide();
                $('#editRealMsgImg').show();
            },
            success: function (data) {
                if (data.errorCode == 0) {
                    alert(data.message);
                    $('#editRealMsgImg').hide();
                    $('#profile_sub').show();
                    location.href="${CPATH}/user/login.html";
                } else if (data.errorCode != 0) {
                    alert("您的邮箱错误，请修改为正确的邮箱");
                    $('#editRealMsgImg').hide();
                    $('#profile_sub').show();
                }
            }
        });
        return false;
    });
</script>


<script type="text/javascript">
    $('.site_loading').animate({'width': '78%'}, 50);  //第三个节点
</script>        <!-- /.Sidebar -->
</@userLayout>
</@layout>